package com.hc.homestay.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hc.homestay.commons.ResultMap;
import com.hc.homestay.pojo.ToGuestHome;
import com.hc.homestay.service.ToClientService;
import com.hc.homestay.service.ToGuestHomeService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

@Api("客房模块接口")
@RestController
@RequestMapping("/toGuestHome")
public class ToGuestHomeController {

	@Autowired
	private ToGuestHomeService toGuestHomeService; // 客户模块的服务层

	@Autowired
	private ToClientService toClientService; // 客户端的服务层

	@ApiOperation(value = "客房分页列表接口")
	@ApiResponses(value = { @ApiResponse(code = 500, message = "数据获取异常"), @ApiResponse(code = 200, message = "OK") })
	@ApiImplicitParams(value = {
			@ApiImplicitParam(name = "page", value = "当前页", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "limit", value = "页大小", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "ghId", value = "客房ID", required = false, dataType = "Integer") })
	@RequestMapping("/getToGuestHome")
	public ResultMap<ToGuestHome> getToGuestHome(
			@ApiParam("当前页") @RequestParam(value = "page", required = false) Integer page,
			@ApiParam("页大小") @RequestParam(value = "limit", required = false) Integer limit,
			@ApiParam("客房ID") @RequestParam(value = "ghId", required = false) Integer ghId) {

		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("page", page);
		paramMap.put("limit", limit);
		paramMap.put("ghId", ghId);

		return toGuestHomeService.selectByPage(paramMap);
	}

}
